package com.zlive.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author bjf
 */
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {


    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http
                //======================/开启httpbasic认证============================
                .httpBasic()
                //.and()
                //======================授权配置============================
                .and()
                .authorizeRequests()
                //不用授权
                .antMatchers("/security/loginPage", "/security/login", "/druid/**").permitAll()
                .anyRequest().authenticated()
                //=======================CSRF===========================
                .and()
                .csrf()
                .disable();
    }


}
